/**
 * @copyright chuzhixin 1204505056@qq.com
 * @description router全局配置，如有必要可分文件抽离，其中asyncRoutes只有在intelligence模式下才会用到，vip文档中已提供路由的基础图标与小清新图标的配置方案，请仔细阅读
 */

import Vue from "vue";
import VueRouter from "vue-router";
import Layout from "@/layouts";
import EmptyLayout from "@/layouts/EmptyLayout";
import EmptyLayoutIndex from "@/layouts/EmptyLayoutIndex";
import { publicPath, routerMode } from "@/config/settings";

Vue.use(VueRouter);
export const constantRoutes = [
  {
    path: "/login",
    component: () => import("@/views/login/index"),
    hidden: true,
  },
  {
    path: "/register",
    component: () => import("@/views/register/index"),
    hidden: true,
  },
  {
    path: "/401",
    name: "401",
    component: () => import("@/views/401"),
    hidden: true,
  },
  {
    path: "/402",
    name: "402",
    component: () => import("@/views/401"),
    hidden: true,
  },
  {
    path: "/404",
    name: "404",
    component: () => import("@/views/404"),
    hidden: true,
  },
];

export const asyncRoutes = [
  {
    path: "/",
    component: EmptyLayoutIndex,
    redirect: "/index",
    meta: {
      title: "首页",
    },
    hide: true,
    children: [
      {
        path: "/index",
        name: "Index",
        component: () => import("@/views/coverIndex/index"),
        meta: {
          title: "首页",
        },
      },
    ],
  },
  {
    path: "/personalCenter",
    component: Layout,
    hidden: true,
    hide: true,
    redirect: "/personalCenter",
    meta: {
      title: "个人中心",
    },
    children: [
      {
        path: "/personalCenter",
        name: "PersonalCenter",
        component: () => import("@/views/personalCenter/index"),
        meta: {
          title: "个人中心",
        },
      },
    ],
  },
  {
    path: "/medicalCareIndex",
    component: Layout,
    hidden: true,
    redirect: "/medicalCareIndex",
    meta: {
      title: "医",
    },
    id: 1,
    children: [
      {
        path: "/medicalCareIndex",
        name: "medicalCareIndex",
        component: () => import("@/views/medicalCare/index"),
        id: 11,
        meta: {
          title: "医老人之需",
        },
      },
      {
        path: "/drugManagement",
        name: "drugManagement",
        redirect: "noRedirect",
        component: EmptyLayout,
        id: 17,
        meta: { title: "药品管理" },
        children: [
          {
            path: "/medicalCare/drug/input",
            name: "medicalCareInput",
            id: 171,
            component: () =>
            import("@/views/medicalCare/drug/input"),
            meta: {
              title: "入库管理",
            },
          },
          {
            path: "/medicalCare/drug/chufang",
            name: "medicalCareChufang",
            id: 172,
            component: () =>
            import("@/views/medicalCare/drug/chufang"),
            meta: {
              title: "处方管理",
            },
          },
          {
            path: "/medicalCare/drug/illness",
            name: "medicalCareIllness",
            id: 173,
            component: () =>
            import("@/views/medicalCare/drug/illness"),
            meta: {
              title: "疾病管理",
            },
          },
          {
            path: "/medicalCare/drug/remove",
            name: "medicalCareRemove",
            id: 174,
            component: () =>
            import("@/views/medicalCare/drug/remove"),
            meta: {
              title: "出库管理",
            },
          },
          {
            path: "/medicalCare/drug/stock",
            name: "medicalCareStockList",
            id: 174,
            component: () =>
            import("@/views/medicalCare/drug/stock-list"),
            meta: {
              title: "库存不足列表",
            },
          },
        ]
      },
      {
        path: "/disease1",
        name: "disease1",
        redirect: "noRedirect",
        component: EmptyLayout,
        id: 12,
        meta: { title: "疾病治疗" },
        children: [
          {
            path: "/medicalCare/disease1/visit",
            name: "medicalCareDisease1Visit",
            id: 121,
            component: () =>
            import("@/views/medicalCare/disease1/visit"),
            meta: {
              title: "就诊记录",
            },
          },
          {
            path: "/medicalCare/disease1/visit-older",
            name: "medicalCareDisease1VisitOlder",
            id: 122,
            component: () =>
            import("@/views/medicalCare/disease1/visit-older"),
            meta: {
              title: "就诊老人列表",
            },
          }
        ]
      },
      {
        path: "/disease3",
        name: "disease3",
        redirect: "noRedirect",
        component: EmptyLayout,
        id: 13,
        meta: { title: "慢性病管理" },
        children: [
          {
            path: "/medicalCare/disease3/visit",
            name: "medicalCareDisease3Visit",
            id: 131,
            component: () =>
            import("@/views/medicalCare/disease3/visit"),
            meta: {
              title: "就诊记录",
            },
          },
          {
            path: "/medicalCare/disease3/visit-older",
            name: "medicalCareDisease3VisitOlder",
            id: 132,
            component: () =>
            import("@/views/medicalCare/disease3/visit-older"),
            meta: {
              title: "就诊老人列表",
            },
          }
        ]
      },
      /* {
        path: "/disease1",
        name: "Disease1",
        component: () => import("@/views/medicalCare/disease1"),
        id: 12,
        meta: {
          title: "疾病治疗",
        },
      }, */
      // {
      //   path: "/disease2",
      //   name: "Disease2",
      //   component: () => import("@/views/medicalCare/disease2"),
      //   meta: {
      //     title: "急性病治疗",
      //   },
      // },
      /* {
        path: "/disease3",
        name: "Disease3",
        id: 13,
        component: () => import("@/views/medicalCare/disease3"),
        meta: {
          title: "慢性病管理",
        },
      }, */
      {
        path: "/disease4",
        name: "Disease4",
        id: 14,
        component: () => import("@/views/medicalCare/disease4"),
        meta: {
          title: "康复训练",
        },
      },
      {
        path: "/disease5",
        name: "Disease5",
        id: 15,
        component: () => import("@/views/medicalCare/disease5"),
        meta: {
          title: "心理慰藉",
        },
      },
      {
        path: "/disease6",
        name: "Disease6",
        id: 16,
        component: () => import("@/views/medicalCare/disease6"),
        meta: {
          title: "安宁服务",
        },
      },
    ],
  },
  {
    path: "/institutionalIndex",
    component: Layout,
    hidden: true,
    redirect: "/institutionalIndex",
    meta: {
      title: "养",
    },
    id: 2,
    children: [
      {
        path: "/institutionalIndex",
        name: "InstitutionalIndex",
        id: 21,
        component: () => import("@/views/institutionalPension/index"),
        meta: {
          title: "首页",
        },
      },
      {
        path: "/appointmentReg",
        name: "AppointmentReg",
        id: 22,
        component: () => import("@/views/institutionalPension/appointmentReg"),
        meta: {
          title: "预约管理",
        },
      },
      {
        path: "/trymanager",
        name: "Trymanager",
        id: 23,
        component: () => import("@/views/institutionalPension/trymanager"),
        meta: {
          title: "试住管理",
        },
      },
      {
        path: "/oldermanager",
        name: "Oldermanager",
        id: 24,
        component: () => import("@/views/institutionalPension/oldermanager"),
        meta: {
          title: "入住管理",
        },
      },
      {
        path: "/visit",
        name: "Visit",
        redirect: "noRedirect",
        component: EmptyLayout,
        id: 241,
        meta: {
          title: "老人管理",
        },
        children: [
          {
            path: "visit",
            name: "Visit",
            id: 242,
            component: () =>
              import("@/views/institutionalPension/visit"),
            meta: { title: "来访记录" },
          },
          {
            path: "oldleave",
            name: "Oldleave",
            id: 243,
            component: () => import("@/views/institutionalPension/oldleave"),
            meta: { title: "外出记录" },
          },
          {
            path: "/oldmanLeave",
            name: "OldmanLeave",
            id: 221,
            component: () =>
              import("@/views/institutionalPension/costmanager/oldmanLeave"),
            meta: {
              title: "老人请假",
            },
          },
          {
            path: "/institutionalPension/deformed",
            name: "Deformed",
            id: 244,
            component: () =>
              import("@/views/institutionalPension/deformed"),
            meta: { title: "残疾老人" },
          },
        ],
      },
      {
        path: "/bedmanager",
        name: "Bedmanager",
        redirect: "noRedirect",
        component: EmptyLayout,
        id: 25,
        meta: {
          title: "床位管理",
        },
        children: [
          {
            path: "bedList",
            name: "BedList",
            id: 26,
            component: () =>
              import("@/views/institutionalPension/bedmanager/bedList"),
            meta: { title: "床位管理" },
          },
          {
            path: "buildingmanager",
            name: "Buildingmanager",
            id: 27,
            component: () =>
              import("@/views/institutionalPension/bedmanager/buildingmanager"),
            meta: { title: "楼栋管理" },
          },
          {
            path: "bedType",
            name: "BedType",
            id: 28,
            component: () =>
              import("@/views/institutionalPension/bedmanager/bedType"),
            meta: { title: "床位类型" },
          },
        ],
      },
      {
        path: "/costmanager",
        name: "Costmanager",
        redirect: "noRedirect",
        component: EmptyLayout,
        id: 29,
        meta: {
          title: "费用管理",
        },
        children: [
          {
            path: "/nursingcost",
            name: "Nursingcost",
            id: 210,
            component: () =>
              import("@/views/institutionalPension/costmanager/nursingcost"),
            meta: {
              title: "护理费用",
            },
          },
          {
            path: "/foodcost",
            name: "Foodcost",
            id: 220,
            component: () =>
              import("@/views/institutionalPension/costmanager/foodcost"),
            meta: {
              title: "餐饮费用",
            },
          },

        ],
      },
      {
        path: "/nursemanager",
        name: "Nursemanager",
        redirect: "noRedirect",
        component: EmptyLayout,
        id: 230,
        meta: {
          title: "人事管理",
        },
        children: [
          {
            path: "/nursemanager",
            name: "Nursemanager",
            id: 240,
            component: () => import("@/views/institutionalPension/nursemanager"),
            meta: {
              title: "员工列表",
            },
          },
          {
            path: "/role",
            name: "Role",
            id: 250,
            component: () => import("@/views/institutionalPension/role"),
            meta: {
              title: "角色管理",
            },
          },
          {
            path: "/depart",
            name: "Depart",
            id: 260,
            component: () => import("@/views/institutionalPension/depart"),
            meta: {
              title: "部门管理",
            },
          },
        ],
      },
    ],
  },
  {
    path: "/healthData",
    component: Layout,
    hidden: true,
    redirect: "/healthData",
    meta: { title: "康" },
    id: 3,
    children: [
      {
        path: "/healthData",
        name: "HealthData",
        id: 31,
        component: () => import("@/views/healthRecords/index"),
        meta: {
          title: "健康档案大数据",
        },
      },
      {
        path: "/healthRecords",
        name: "HealthRecords",
        id: 32,
        component: () => import("@/views/healthRecords/list"),
        meta: {
          title: "老人健康管理档案",
        },
      },
    ],
  },
  {
    path: "/badNum",
    component: Layout,
    hidden: true,
    redirect: "/badNum",
    meta: {
      title: "护",
    },
    id: 4,
    children: [
      {
        path: "/badNum",
        name: "BadNum",
        id: 41,
        component: () => import("@/views/intelligentCare/badNum"),
        meta: {
          title: "床位管理",
        },
      },
      {
        path: "/lightManage",
        name: "LightManage",
        id: 42,
        component: () => import("@/views/intelligentCare/lightManage"),
        meta: {
          title: "智能房间",
        },
      },
      // {
      //   path: "/lightCsManage",
      //   name: "LightCsManage",
      //   id: 421,
      //   component: () => import("@/views/intelligentCare/lightCsManage"),
      //   meta: {
      //     title: "智能房间",
      //   },
      // },
      {
        path: "/ysxRoom",
        name: "YsxRoom",
        id: 43,
        component: () => import("@/views/intelligentCare/ysxRoom"),
        meta: { title: "尉氏县服务中心", hidden: true },
      },
      // {
      //   path: "/testdevice",
      //   name: "Testdevice",
      //   component: () => import("@/views/intelligentCare/testdevice"),
      //   meta: {
      //     title: "测试情景模式",
      //   },
      // },
      // {
      //   path: "/test",
      //   name: "Test",
      //   component: () => import("@/views/intelligentCare/test"),
      //   meta: {
      //     title: "测试界面",
      //   },
      // },
      // {
      //   path: "/toilet",
      //   name: "Toilet",
      //   id: 44,
      //   component: () => import("@/views/intelligentCare/toilet"),
      //   meta: {
      //     title: "卫生间",
      //   },
      // },
      {
        path: "/ICU",
        name: "Icu",
        id: 45,
        component: () => import("@/views/intelligentCare/ICU"),
        meta: {
          title: "智能监护",
        },
      },
      {
        path: "/warning",
        name: "Warning",
        id: 46,
        component: () => import("@/views/intelligentCare/warningInfo"),
        meta: {
          title: "报警信息",
        },
      },
      // {
      //   path: "/deviceList",
      //   name: "Devicelist",
      //   id: 47,
      //   component: () => import("@/views/intelligentCare/deviceList"),
      //   meta: {
      //     title: "设备管理",
      //   },
      // },
    ],
  },
  {
    path: "/entertainment",
    component: Layout,
    hidden: true,
    redirect: "/entertainment",
    meta: { title: "乐" },
    id: 5,
    children: [
      {
        path: "/entertainment",
        name: "Entertainment",
        id: 51,
        component: () => import("@/views/entertainment/interest.vue"),
        meta: {
          title: "兴趣小课堂",
        },
      },
      {
        path: "/bodybuilding",
        name: "Bodybuilding",
        id: 52,
        component: () => import("@/views/entertainment/bodybuilding.vue"),
        meta: {
          title: "健身运动",
        },
      },
      {
        path: "/food",
        name: "Food",
        id: 53,
        component: () => import("@/views/entertainment/food"),
        meta: {
          title: "饮食与养生",
        },
      },
      {
        path: "/quanxian",
        name: "quanxian",
        hidden: true,
        id: 54,
        component: () => import("@/views/entertainment/food"),
        meta: {
          title: "新增/删除权限",
        },
      },
    ],
  },
  {
    path: "/trainingCourse",
    component: Layout,
    hidden: true,
    redirect: "/trainingCourse",
    meta: { title: "学" },
    id: 6,
    children: [
      {
        path: "/trainingCourse",
        name: "TrainingCourse",
        id: 61,
        component: () => import("@/views/course/huliCourse"),
        meta: {
          title: "护理知识",
        },
      },
      {
        path: "/lineCourse",
        name: "LineCourse",
        id: 62,
        component: () => import("@/views/course/lineCourse"),
        meta: {
          title: "在线培训",
        },
      },
      {
        path: "/yiliaoCourse",
        name: "YiliaoCourse",
        id: 63,
        component: () => import("@/views/course/yiliaoCourse"),
        meta: {
          title: "医疗小知识",
        },
      },
      {
        path: "/quanxian",
        name: "quanxian",
        id: 64,
        hidden: true,
        component: () => import("@/views/course/yiliaoCourse"),
        meta: {
          title: "新增/删除权限",
        },
      },
    ],
  },
  {
    path: "/helpManager",
    component: Layout,
    hidden: true,
    redirect: "/helpManager",
    meta: { title: "助" },
    id: 7,
    children: [
      {
        path: "/helpManager",
        name: "helpManager",
        id: 71,
        component: () => import("@/views/helpManager/index"),
        meta: {
          title: "首页",
        },
      },
      {
        path: "/materialReceiving",
        name: "MaterialReceiving",
        id: 72,
        component: () => import("@/views/helpManager/materialReceiving"),
        meta: {
          title: "物资接收",
        },
      },
      {
        path: "/materialDistribution",
        name: "MaterialDistribution",
        id: 73,
        component: () => import("@/views/helpManager/materialDistribution"),
        meta: {
          title: "物资分配",
        },
      },
      {
        path: "/helpWangge",
        name: "helpWangge",
        redirect: "noRedirect",
        component: EmptyLayout,
        id: 74,
        meta: { title: "设备管理" },
        children: [
          {
            path: "/helpFaceManager",
            name: "helpFaceManager",
            id: 741,
            component: () =>
            import("@/views/helpManager/wangge/faceManager"),
            meta: {
              title: "人脸设备管理",
            },
          },
          {
            path: "/helpWanggeList",
            name: "helpWanggeList",
            id: 742,
            component: () =>
            import("@/views/helpManager/wangge/list"),
            meta: {
              title: "站点管理",
            },
          },
          {
            path: "/helpWanggeUser",
            name: "helpWanggeUser",
            id: 743,
            component: () =>
            import("@/views/helpManager/wangge/user"),
            meta: {
              title: "员工管理",
            },
          },
        ]
      },
      {
        path: "/dailycare",
        name: "dailycare",
        redirect: "noRedirect",
        component: EmptyLayout,
        id: 75,
        meta: { title: "日间照料" },
        children: [
          {
            path: "/dailycareActivityList",
            name: "dailycareActivityList",
            id: 751,
            component: () =>
            import("@/views/helpManager/dailycare/activity-list"),
            meta: {
              title: "活动列表",
            },
          },
          {
            path: "/dailycareOlderList",
            name: "dailycareOlderList",
            id: 752,
            component: () =>
            import("@/views/helpManager/dailycare/older-list"),
            meta: {
              title: "老人列表",
            },
          },
          {
            path: "/dailycareCaptureRecord",
            name: "dailycareCaptureRecord",
            id: 753,
            component: () =>
            import("@/views/helpManager/dailycare/capture-record"),
            meta: {
              title: "抓拍记录",
            },
          },
          {
            path: "/dailycareActivityDetail",
            name: "dailycareActivityDetail",
            id: 754,
            hidden: true,
            component: () =>
            import("@/views/helpManager/dailycare/activity-detail"),
            meta: {
              title: "活动详情",
            },
          },
        ]
      },
      {
        path: "/integral",
        name: "integral",
        redirect: "noRedirect",
        component: EmptyLayout,
        id: 76,
        meta: { title: "积分商城" },
        children: [
          {
            path: "/integralGoodsStock",
            name: "integralGoodsStock",
            id: 761,
            component: () =>
            import("@/views/helpManager/integral/goods-stock"),
            meta: {
              title: "礼品总仓库",
            },
          },
          {
            path: "/integralGoodsLog",
            name: "integralGoodsLog",
            id: 752,
            component: () =>
            import("@/views/helpManager/integral/goods-log"),
            meta: {
              title: "总仓库礼品记录",
            },
          },
          {
            path: "/integralGoodsManage",
            name: "integralGoodsManage",
            id: 763,
            component: () =>
            import("@/views/helpManager/integral/goods-manage"),
            meta: {
              title: "站点礼品",
            },
          },
          {
            path: "/integralTeamGoods",
            name: "integralTeamGoods",
            id: 764,
            component: () =>
            import("@/views/helpManager/integral/team-goods"),
            meta: {
              title: "站点兑换记录",
            },
          },
          {
            path: "/integralTeamGoodsLog",
            name: "integralTeamGoodsLog",
            id: 765,
            component: () =>
            import("@/views/helpManager/integral/team-goods-log"),
            meta: {
              title: "站点礼品记录",
            },
          },
        ]
      },
    ],
  },
  {
    path: "/doorService",
    component: Layout,
    hidden: true,
    redirect: "/doorService",
    meta: { title: "动" },
    id: 8,
    children: [
      {
        path: "/doorService",
        name: "DoorService",
        id: 81,
        component: () => import("@/views/doorService/index"),
        meta: { title: "首页" },
      },
      {
        path: "/bodyService",
        name: "BodyService",
        id: 82,
        component: () => import("@/views/doorService/testBody"),
        meta: { title: "流动服务车" },
      },
      {
        path: "/civilService",
        name: "CivilService",
        redirect: "noRedirect",
        component: EmptyLayout,
        id: 83,
        meta: { title: "健康指导" },
        children: [
          {
            path: "/civilService",
            name: "civilService",
            id: 831,
            component: () =>
              import("@/views/doorService/doorService"),
            meta: {
              title: "健康指导",
            },
          },
          {
            path: "/personManager",
            name: "personManager",
            id: 832,
            component: () =>
            import("@/views/doorService/personManager"),
            meta: {
              title: "服务人员管理",
            },
          },
          {
            path: "/doorServiceMsg",
            name: "DoorServiceMsg",
            id: 833,
            component: () =>
            import("@/views/doorService/doorServiceMsg"),
            meta: {
              title: "服务信息",
            },
          }
        ]
      },
      /* {
        path: "/personManager",
        name: "PersonManager",
        id: 84,
        component: () => import("@/views/doorService/personManager"),
        meta: { title: "服务人员管理" },
      }, */
      {
        path: "/wangge",
        name: "Wangge",
        redirect: "noRedirect",
        component: EmptyLayout,
        id: 85,
        meta: { title: "网格站点", hidden: true },
        children: [
          {
            path: "/wanggeList",
            name: "wanggeList",
            id: 851,
            component: () =>
            import("@/views/doorService/wangge/list"),
            meta: {
              title: "网格站点列表",
            },
          },
          {
            path: "/wanggeUser",
            name: "wanggeUser",
            id: 852,
            component: () =>
            import("@/views/doorService/wangge/user"),
            meta: {
              title: "网格员工列表",
            },
          },
          {
            path: "/wanggeSolder",
            name: "wanggeSolder",
            id: 853,
            component: () =>
            import("@/views/doorService/wangge/solder"),
            meta: {
              title: "老人列表",
            },
          }
        ]
      },
      {
        path: "/serve",
        name: "Serve",
        redirect: "noRedirect",
        component: EmptyLayout,
        id: 86,
        meta: { title: "服务监管", hidden: true },
        children: [
          {
            path: "/serveTasklist",
            name: "serveTasklist",
            id: 8612,
            component: () =>
            import("@/views/doorService/serve/tasklist"),
            meta: {
              title: "任务列表",
            },
          },
          {
            path: "/serveOrderlist",
            name: "serveOrderlist",
            id: 8611,
            component: () =>
            import("@/views/doorService/serve/orderlist"),
            meta: {
              title: "拓展订单列表",
            },
          },
          {
            path: "/serveFreeOrderlist",
            name: "serveFreeOrderlist",
            id: 8610,
            component: () =>
            import("@/views/doorService/serve/free-orderlist"),
            meta: {
              title: "政府订单列表",
            },
          },
          {
            path: "/serveOrderactivity",
            name: "serveOrderactivity",
            id: 869,
            component: () =>
            import("@/views/doorService/serve/orderactivity"),
            meta: {
              title: "活动列表",
            },
          },
          {
            path: "/serveFeed",
            name: "serveFeed",
            id: 868,
            component: () =>
            import("@/views/doorService/serve/feed"),
            meta: {
              title: "质量监管",
            },
          },
          {
            path: "/serveStaffServeList",
            name: "serveStaffServeList",
            id: 867,
            component: () =>
            import("@/views/doorService/serve/staff-serve-list"),
            meta: {
              title: "员工服务信息",
            },
          },
          {
            path: "/serveElderServedList",
            name: "serveElderServedList",
            id: 866,
            component: () =>
            import("@/views/doorService/serve/elder-served-list"),
            meta: {
              title: "服务老人信息",
            },
          },
          {
            path: "/serveStaffTask",
            name: "serveStaffTask",
            id: 865,
            component: () =>
            import("@/views/doorService/serve/staff-task"),
            meta: {
              title: "员工任务订单",
            },
          },
          {
            path: "/serveLeaderTask",
            name: "serveLeaderTask",
            id: 864,
            component: () =>
            import("@/views/doorService/serve/leader-task"),
            meta: {
              title: "站长分配情况",
            },
          },
          {
            path: "/serveTeamTask",
            name: "serveTeamTask",
            id: 863,
            component: () =>
            import("@/views/doorService/serve/team-task"),
            meta: {
              title: "站点任务订单",
            },
          },
          {
            path: "/serveTypelist",
            name: "serveTypelist",
            id: 862,
            component: () =>
            import("@/views/doorService/serve/typelist"),
            meta: {
              title: "任务类型",
            },
          },
          {
            path: "/serveTaskIcon",
            name: "serveTaskIcon",
            id: 861,
            component: () =>
            import("@/views/doorService/serve/task-icon"),
            meta: {
              title: "任务图标",
            },
          },
        ]
      },
    ],
  },
  {
    path: "/map",
    component: Layout,
    redirect: "/map",
    hidden: true,
    hide: true,
    children: [
      {
        path: "/map",
        component: () => import("@/views/map/index"),
        name: "Map",
        meta: {
          title: "地图",
        },
      },
      {
        path: "/mapData",
        name: "MapData",
        redirect: "noRedirect",
        component: EmptyLayout,
        meta: {
          title: "地图数据",
        },
        children: [
          {
            path: "yanglaojigou",
            name: "Yanglaojigou",
            component: () => import("@/views/map/olderData.vue"),
            meta: { title: "养老机构" },
          },
          {
            path: "fuwujigou",
            name: "Fuwujigou",
            component: () => import("@/views/map/serveData.vue"),
            meta: { title: "服务机构" },
          },
        ],
      },
    ],
  },
  {
    path: "/error",
    component: EmptyLayout,
    redirect: "noRedirect",
    hidden: true,
    hide: true,
    name: "Error",
    meta: { title: "错误页", icon: "bug" },
    children: [
      {
        path: "401",
        name: "Error401",
        component: () => import("@/views/401"),
        meta: { title: "401" },
      },
      {
        path: "404",
        name: "Error404",
        component: () => import("@/views/404"),
        meta: { title: "404" },
      },
    ],
  },
  {
    path: "*",
    redirect: "/404",
    hidden: true,
    hide: true,
  },
];

const router = new VueRouter({
  base: routerMode === "history" ? publicPath : "",
  mode: routerMode,
  scrollBehavior: () => ({
    y: 0,
  }),
  routes: constantRoutes,
});
//注释的地方是允许路由重复点击，如果你觉得框架路由跳转规范太过严格可选择放开
const originalPush = VueRouter.prototype.push;
VueRouter.prototype.push = function push(location, onResolve, onReject) {
  if (onResolve || onReject)
    return originalPush.call(this, location, onResolve, onReject);
  return originalPush.call(this, location).catch((err) => err);
};

export function resetRouter() {
  router.matcher = new VueRouter({
    base: routerMode === "history" ? publicPath : "",
    mode: routerMode,
    scrollBehavior: () => ({
      y: 0,
    }),
    routes: constantRoutes,
  }).matcher;
}

export default router;
